﻿#ifndef DBCONFIG_INCLUDE_H
#define DBCONFIG_INCLUDE_H

#include <QtCore>
#include "TABLEDEFINE.h"

#pragma pack(1)


enum SHOW_FLAG
{
	SHOW_FLAG_NORMAL			=0,
	SHOW_FLAG_UNSAVE			=1,	
	SHOW_FLAG_ERROR				=2,
};


enum TREE_TYPE
{
	//	TREE_TYPE_DB_INFO			,		//数据库信息
	TREE_TYPE_SECONDARY				,		//二次侧
	TREE_TYPE_NUM						
};
enum ITEM_TYPE
{
	ITEM_TYPE_NSA3000T_CD = 0,
	ITEM_TYPE_NSA3000T_RD  ,
};

#define EXP_IO_MAX_NUM      50 

typedef struct GooseTreeType
{
	int      tableid;
	int      parentid;
	int      id;
	unsigned char devtype;
	unsigned char devaddr;
	unsigned short indexno;
}IOTreeTypeS;
//ccg 逻辑节点树形结构结构体
typedef struct LNTreeType
{
	int      tableid;
	int      parentid;
	int      id;
	char		   Name[NAME_SIZE];                 //逻辑节点类型
	char		   Desc[NAME_SIZE];				    //描述desc
	char		   lnClass[BYNAME_LEN];             //逻辑节点类
}LNTreeType;

typedef struct 
{
	char Opr[7];
	unsigned char Pri;
}OPR_PRI;

class QTreeWidgetItem;
Q_DECLARE_METATYPE(IOTreeTypeS);

typedef struct _TreeItemData
{
	quint32  itemtype;
	quint32  PtlParamType;				//类型
	quint32	 AppType;				//应用类型
	quint32  ParentTableId;			//父表ID
	quint32	 ShowTableId;			//显示表ID
	quint32	 RecordId;				//记录ID
	quint32	 parentId;				//带偏移
	quint32  Fun;
	_TreeItemData()
	{
		itemtype=0;
		PtlParamType=0;
		AppType = 0;
		ParentTableId = 0;
		ShowTableId = 0;
		RecordId = 0;
		parentId = 0;
		Fun=0;
	}	
	~_TreeItemData()
	{
	}
	void Clear()
	{
		PtlParamType=0;
		AppType = 0;
		ParentTableId = 0;
		ShowTableId = 0;
		RecordId = 0;
		parentId = 0;
		Fun=0;
	}

}TreeItemData;

Q_DECLARE_METATYPE(TreeItemData);
// 
// typedef struct _UserItemData
// {
//         quint32  UserId;				//
//         quint32	 UserGroup;				//
//         quint32	 UserPermis;			//
//         _UserItemData()
//         {
//                 UserId = 0;
//                 UserGroup = 0;
//                 UserPermis =0;
//         }
//         ~_UserItemData()
//         {
//         }
// 
// }UserItemData;
// 
// Q_DECLARE_METATYPE(UserItemData);

typedef struct _Index_ItemData
{
	quint32		DeviceId;
	quint32		IndexId;
	quint32		IndexNo;
	_Index_ItemData()
	{
		DeviceId=0;
		IndexId=0;
		IndexNo=0;
	}
}Index_ItemData;
Q_DECLARE_METATYPE(Index_ItemData);

typedef struct _Trans_ItemData
{
	quint32		RecordId;
	quint32		TransNo;
	quint32		OldeTransNo;
	quint32		DeviceId;
	quint32		IndexId;
	quint32		IndexNo;
	quint32		TaskId;
	quint8		DataProp;
	bool		bDeleteFlag;
	_Trans_ItemData()
	{
		RecordId=0;
		TransNo=0;
		OldeTransNo=0;
		DeviceId=0;
		IndexId=0;
		IndexNo=0;
		TaskId=0;
		DataProp=0;
		bDeleteFlag = false;
	}
}Trans_ItemData;
Q_DECLARE_METATYPE(Trans_ItemData);

#pragma pack()


#endif // DBCONFIG_INCLUDE_H
